home *** CD-ROM | disk | FTP | other *** search
/ com!online 2005 April / com_0405_1.iso / opensource / gimp-2.2.1-i586-setup / gimp-2.2.1-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / frosty-logo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2005-01-05  |  4.7 KB  |  125 lines

  1. ;  FROZEN-TEXT effect
  2. ;  Thanks to Ed Mackey for this one
  3. ;   Written by Spencer Kimball
  4.  
  5. (define (apply-frosty-logo-effect img
  6.                   logo-layer
  7.                   size
  8.                   bg-color)
  9.   (let* ((border (/ size 5))
  10.      (width (car (gimp-drawable-width logo-layer)))
  11.      (height (car (gimp-drawable-height logo-layer)))
  12.      (logo-layer-mask (car (gimp-layer-create-mask logo-layer ADD-BLACK-MASK)))
  13.      (sparkle-layer (car (gimp-layer-new img width height RGBA-IMAGE "Sparkle" 100 NORMAL-MODE)))
  14.      (matte-layer (car (gimp-layer-new img width height RGBA-IMAGE "Matte" 100 NORMAL-MODE)))
  15.      (shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 90 MULTIPLY-MODE)))
  16.      (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
  17.      (selection 0))
  18.  
  19.     (gimp-context-push)
  20.  
  21.     (gimp-layer-add-mask logo-layer logo-layer-mask)
  22.     (script-fu-util-image-resize-from-layer img logo-layer)
  23.     (gimp-image-add-layer img sparkle-layer 2)
  24.     (gimp-image-add-layer img matte-layer 3)
  25.     (gimp-image-add-layer img shadow-layer 4)
  26.     (gimp-image-add-layer img bg-layer 5)
  27.     (gimp-selection-none img)
  28.     (gimp-edit-clear sparkle-layer)
  29.     (gimp-edit-clear matte-layer)
  30.     (gimp-edit-clear shadow-layer)
  31.     (gimp-selection-layer-alpha logo-layer)
  32.     (set! selection (car (gimp-selection-save img)))
  33.     (gimp-selection-feather img border)
  34.     (gimp-context-set-background '(0 0 0))
  35.     (gimp-edit-fill sparkle-layer BACKGROUND-FILL)
  36.     (plug-in-noisify 1 img sparkle-layer FALSE 0.2 0.2 0.2 0.0)
  37.     (plug-in-c-astretch 1 img sparkle-layer)
  38.     (gimp-selection-none img)
  39.     (plug-in-sparkle 1 img sparkle-layer 0.03 0.5 (/ (min width height) 2) 6 15 1.0 0.0 0.0 0.0 FALSE FALSE FALSE 0)
  40.     (gimp-levels sparkle-layer 1 0 255 0.2 0 255)
  41.     (gimp-levels sparkle-layer 2 0 255 0.7 0 255)
  42.     (gimp-selection-layer-alpha sparkle-layer)
  43.     (gimp-context-set-foreground '(0 0 0))
  44.     (gimp-context-set-brush "Circle Fuzzy (11)")
  45.     (gimp-edit-stroke matte-layer)
  46.     (gimp-selection-feather img border)
  47.     (gimp-edit-fill shadow-layer BACKGROUND-FILL)
  48.     (gimp-selection-none img)
  49.     (gimp-context-set-background bg-color)
  50.     (gimp-edit-fill bg-layer BACKGROUND-FILL)
  51.     (gimp-context-set-background '(0 0 0))
  52.     (gimp-edit-fill logo-layer BACKGROUND-FILL)
  53. ;    (gimp-layer-add-mask logo-layer logo-layer-mask)
  54.     (gimp-selection-load selection)
  55.     (gimp-context-set-background '(255 255 255))
  56.     (gimp-edit-fill logo-layer-mask BACKGROUND-FILL)
  57.     (gimp-selection-feather img border)
  58.     (gimp-selection-translate img (/ border 2) (/ border 2))
  59.     (gimp-edit-fill logo-layer BACKGROUND-FILL)
  60.     (gimp-layer-remove-mask logo-layer 0)
  61.     (gimp-selection-load selection)
  62.     (gimp-context-set-brush "Circle Fuzzy (07)")
  63.     (gimp-context-set-paint-mode BEHIND-MODE)
  64.     (gimp-context-set-foreground '(186 241 255))
  65.     (gimp-edit-stroke logo-layer)
  66.     (gimp-selection-none img)
  67.     (gimp-image-remove-channel img selection)
  68.     (gimp-layer-translate shadow-layer border border)
  69.  
  70.     (gimp-context-pop)))
  71.  
  72. (define (script-fu-frosty-logo-alpha img
  73.                      logo-layer
  74.                      size
  75.                      bg-color)
  76.   (begin
  77.     (gimp-image-undo-group-start img)
  78.     (apply-frosty-logo-effect img logo-layer size bg-color)
  79.     (gimp-image-undo-group-end img)
  80.     (gimp-displays-flush)))
  81.  
  82.  
  83. (script-fu-register "script-fu-frosty-logo-alpha"
  84.             _"_Frosty..."
  85.             "Frozen logos with drop shadows"
  86.             "Spencer Kimball & Ed Mackey"
  87.             "Spencer Kimball & Ed Mackey"
  88.             "1997"
  89.             "RGBA"
  90.                     SF-IMAGE      "Image"                 0
  91.                     SF-DRAWABLE   "Drawable"              0
  92.             SF-ADJUSTMENT _"Effect size (pixels)" '(100 2 1000 1 10 0 1)
  93.             SF-COLOR      _"Background color"     '(255 255 255))
  94.  
  95. (script-fu-menu-register "script-fu-frosty-logo-alpha"
  96.              _"<Image>/Script-Fu/Alpha to Logo")
  97.  
  98. (define (script-fu-frosty-logo text
  99.                    size
  100.                    font
  101.                    bg-color)
  102.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  103.      (border (/ size 5))
  104.      (text-layer (car (gimp-text-fontname img -1 0 0 text (* border 2) TRUE size PIXELS font))))
  105.     (gimp-image-undo-disable img)
  106.     (gimp-drawable-set-name text-layer text)
  107.     (apply-frosty-logo-effect img text-layer size bg-color)
  108.     (gimp-image-undo-enable img)
  109.     (gimp-display-new img)))
  110.  
  111. (script-fu-register "script-fu-frosty-logo"
  112.             _"_Frosty..."
  113.             "Frozen logos with drop shadows"
  114.             "Spencer Kimball & Ed Mackey"
  115.             "Spencer Kimball & Ed Mackey"
  116.             "1997"
  117.             ""
  118.             SF-STRING     _"Text"               "The GIMP"
  119.             SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
  120.             SF-FONT       _"Font"               "Becker"
  121.             SF-COLOR      _"Background color"   '(255 255 255))
  122.  
  123. (script-fu-menu-register "script-fu-frosty-logo"
  124.              _"<Toolbox>/Xtns/Script-Fu/Logos")
  125.